//NOTE: You must update this .do file with the path of the saved .dta file in order to run.

//FIGURE 2 (Contested UNGA Votes by Issue Area, 1965-2017)
use "D:\Dropbox\YCP\Research\UNGA G77 Votes\Data\UN Vote Data (final).dta", clear
drop if year<1965
drop if year>2017
tostring year, replace
gen str yr=substr(year,3,2)
replace yr="'"+yr
destring year, replace
graph bar (sum) ec nu di co me, over(yr, label(angle(90) labsize(*.55)) sort(year)) stack bar(1, color("56 87 35")) bar(2, color("191 144 0")) bar(3, color("132 60 12")) bar(4, color("31 78 121")) bar(5, color("197 90 17")) legend(symxsize(7) size(*.6) order(1 "Development" 2 "Nukes" 3 "Arms" 4 "Colonialism" 5 "Palestine") rows(1)) ytitle("Number of Contested UNGA Votes", size(*.8)) yscale(titlegap(5)) ylabel(,labsize(small)) graphregion(color(white))


//FIGURE 3 (Wealth Heterogeneity and G77 Voting Cohesion at the UNGA)
use "D:\Dropbox\YCP\Research\UNGA G77 Votes\Data\UN Vote Data (final)", clear
keep rcid cohesion_G77 cohesion_G77_2 year unres gdp_77_sd capita_gdp_77_sd
order year, first
order rcid cohesion_G77 cohesion_G77_2, a(year)
drop if year<1965 //drop observations before G77 was formed
//delete duplicate observations (RCID) (USE FOR PER-VOTE BASIS)
sort rcid
quietly by rcid: gen dup=cond(_N==1,0,_n)
drop if dup>1
drop dup
sort year rcid
egen cohesionG77_mean=mean(cohesion_G77), by(year)
egen cohesionG77_mean_2=mean(cohesion_G77_2), by(year)
gen log=log(gdp_77_sd)
gen yearLabel=""
replace yearLabel="1965" if year==1965
replace yearLabel="1975" if year==1975
replace yearLabel="1985" if year==1985
replace yearLabel="1995" if year==1995
replace yearLabel="2005" if year==2005
replace yearLabel="2015" if year==2015
gen position=.
replace position=9 if yearLabel=="1965"
replace position=4 if yearLabel=="1975"
replace position=6 if yearLabel=="1985"
replace position=6 if yearLabel=="1995"
replace position=5 if yearLabel=="2005"
replace position=1 if yearLabel=="2015"
//MANUSCRIPT VERSION (ABSTENTIONS AS NO VOTES)
lowess cohesionG77_mean log, xtitle(Standard Deviation of G77 Member-States' GDP (log), margin(medium)) ytitle (Mean Cohesion Score, margin(medium)) xscale(range(11.5 15)) xlabel(12 13 14 15) yscale(range(50 100)) ylabel(50 60 70 80 90 100) title("") graphregion(color(white)) mcolor(black) msize(small) mlabel(yearLabel) mlabv(position) mlabcolor(black) mlabsize(small) lineop(lcolor(black)) bwidth(.5) note(LOESS Smoothing Parameter = 0.5, ring(0) position(5) size(small))
//MANUSCRIPT VERSION (ABSTENTIONS AS MISSING)
lowess cohesionG77_mean_2 log, xtitle(Standard Deviation of G77 Member-States' GDP (log), margin(medium)) ytitle (Mean Cohesion Score, margin(medium)) xscale(range(11.5 15)) xlabel(12 13 14 15) yscale(range(50 100)) ylabel(50 60 70 80 90 100) title("") graphregion(color(white)) mcolor(black) msize(small) mlabel(yearLabel) mlabv(position) mlabcolor(black) mlabsize(small) lineop(lcolor(black)) bwidth(.5) note(LOESS Smoothing Parameter = 0.5, ring(0) position(5) size(small))


//TABLE 1 (Determinants of Voting With G77 Majority Position)
use "D:\Dropbox\YCP\Research\UNGA G77 Votes\Data\UN Vote Data (final).dta", clear
drop if year<1965 //drop all observations before G77 was formed
//MANUSCRIPT VERSION: USING ABSTAINS AS NO VOTES
clogit withMajority capita_gdp_77_relative polity population basic if g77==1, group(rcid) vce(cluster rcid) //all issues together
clogit withMajority capita_gdp_77_relative polity population basic if ec==1 & g77==1, group(rcid) vce(cluster rcid) //economic dev
clogit withMajority capita_gdp_77_relative polity population basic if nu==1 & g77==1, group(rcid) vce(cluster rcid) //nuclear weapons
clogit withMajority capita_gdp_77_relative polity population basic if di==1 & g77==1, group(rcid) vce(cluster rcid) //arms control
clogit withMajority capita_gdp_77_relative polity population basic if co==1 & g77==1, group(rcid) vce(cluster rcid) //colonialism
clogit withMajority capita_gdp_77_relative polity population basic if me==1 & g77==1, group(rcid) vce(cluster rcid) //Middle East
//APPENDIX VERSION: USING ABSTAINS AS MISSING
clogit withMajority_2 capita_gdp_77_relative polity population basic if g77==1, group(rcid) vce(cluster rcid) //all issues together
clogit withMajority_2 capita_gdp_77_relative polity population basic if ec==1 & g77==1, group(rcid) vce(cluster rcid) //economic dev
clogit withMajority_2 capita_gdp_77_relative polity population basic if nu==1 & g77==1, group(rcid) vce(cluster rcid) //nuclear weapons
clogit withMajority_2 capita_gdp_77_relative polity population basic if di==1 & g77==1, group(rcid) vce(cluster rcid) //arms control
clogit withMajority_2 capita_gdp_77_relative polity population basic if co==1 & g77==1, group(rcid) vce(cluster rcid) //colonialism
clogit withMajority_2 capita_gdp_77_relative polity population basic if me==1 & g77==1, group(rcid) vce(cluster rcid) //Middle East
